<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGroupPoliciesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('group_policies', function (Blueprint $table) {
            $table->unsignedBigInteger('id')->primary();
            $table->string('name',255)->default('')->comment('策略名称');
            $table->unsignedBigInteger('user_id')->default(0)->comment('创建人!')->index('author');
            $table->enum('cate',['DEVICE','STAFF'])->default('DEVICE')->comment('策略分类 适用于设备分组 或者 员工分组');
            $table->enum('resource_cate',['CURRENT','CUSTOM'])->default('CURRENT')->comment('策略内容分类');
            $table->timestamps();
            $table->softDeletes();
            $table->charset = 'utf8mb4';
            $table->collation = 'utf8mb4_unicode_ci';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('group_policies');
    }
}
